﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Jewelnoid
{
    class Text2D
    {
        public SpriteFont spriteFont;
        public SpriteEffects effect;
        public String text;
        public Vector2 position;
        public Vector2 origin;
        public Vector2 scale;
        public Color color;
        public float alpha;
        public float rotation;
        public float layerDepth;

        public Text2D(SpriteFont spriteFont, String text, Vector2 position, Color color)
        {
            this.spriteFont = spriteFont;
            this.text = text;
            this.position = position;
            this.color = color;
            this.alpha = 1.0f;
            this.rotation = 0f;
            this.layerDepth = 0f;
            this.scale = new Vector2(1f, 1f);
            this.origin = new Vector2(0f, 0f);
            this.effect = SpriteEffects.None;
        }

        public void draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(this.spriteFont, this.text, this.position, this.color * this.alpha, this.rotation, this.origin, this.scale, this.effect, this.layerDepth);
        }

        public float width()
        {
            return spriteFont.MeasureString(text).X;
        }

        public float height()
        {
            return spriteFont.MeasureString(text).Y;
        }
    }
}
